import uuid

from pydantic import BaseModel, Field
from typing import Optional, List, Dict, Any

class ToolDescription(BaseModel):
    name: str
    description: str
    parameters: Dict[str, Any]
    return_type: str

class ResourceDescription(BaseModel):
    uri: str
    description: str
    content_type: str

class ToolInvocation(BaseModel):
    tool_name: str
    parameters: Dict[str, Any]

class ToolResult(BaseModel):
    success: bool
    output: Optional[Any] = None
    error: Optional[str] = None

class MCPRequest(BaseModel):
    request_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
    action: str  # "list_tools", "invoke_tool", "get_resource"
    payload: Optional[Dict[str, Any]] = None

class MCPResponse(BaseModel):
    request_id: str
    success: bool
    data: Optional[Any] = None
    error: Optional[str] = None